import Vue from 'vue'

Vue.filter('TXLStatus', function(str){
	str = parseInt(str)

	switch(str){
		case 1: str = '求购中'; break;
		case 2: str = '待付款'; break;
		case 3: str = '待放行'; break;
		case 10: str = '已完成'; break;
		case 11: str = '出售中'; break;
		case 12: str = '待付款'; break;
		case 13: str = '待放行'; break;
		default: str = '未知'
	}

	return str
})


Vue.filter('fmtDate', function(inputTime){
	inputTime = parseInt(inputTime + '000')
    var date = new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;

})

Vue.filter('ymtDate', function(inputTime){
	inputTime = parseInt(inputTime + '000')
    var date = new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    return  m + '-' + d+' '+h+':'+minute;

})
